package com.gehj.commonui;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

public class MyView  extends View {
    private Paint mPaint;
    private RectF mRect;
    private Path pointerPath;

    //IMPORTANT:一个参数是是从代码里创建view使用
    public MyView(Context context) {
        super(context);
    }

    //IMPORTANT:两个参数是从xml创建使用 xml里用必须复写 可以说相当于activity的 onCreate
    public MyView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initPaint();
    }

    private void initPaint() {
        mPaint = new Paint();
        mPaint.setAntiAlias(true);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        mPaint.setColor(Color.RED);
        canvas.drawCircle(12,89,10,mPaint);
    }
}
